#include "Target.h"

#include "OgreFrameWork.h"

/** @brief getOject
  *
  * @todo: document this function
  */
Object* Target::getOject()
{
Object* r=0;
if (m_targetType == TAR_OBJECT
    || m_targetType == TAR_BUILDING
    || m_targetType == TAR_ITEM
    || m_targetType == TAR_CREATURE)
    {
        r = m_objectTargeted;
    }
    else
    {
       OgreFramework::getSingletonPtr()->m_pLog->logMessage("WARNING : Target::getOject() target type doesn't correspond");
    }
    return r;
}

/** @brief getPosition
  *
  * @todo: document this function
  */
Ogre::Vector2 Target::getPosition()
{
Ogre::Vector2 p = Ogre::Vector2(0,0);

if (m_targetType == TAR_POSITION )
    {
        p = m_positionTargeted;
    }
    else
    {
       OgreFramework::getSingletonPtr()->m_pLog->logMessage("WARNING : Target::getPosition() target type doesn't correspond");
    }
    return p;
}

/** @brief getType
  *
  * @todo: document this function
  */
Target::TARGET_TYPE Target::getType()
{
return m_targetType;
}

/** @brief setType
  *
  * @todo: document this function
  */
void Target::setType(TARGET_TYPE _type)
{
m_targetType = _type;
}

/** @brief Target
  *
  * @todo: document this function
  */
 Target::Target(TARGET_TYPE _type):
 m_targetType(_type)
{
m_isEmpty=true;

}

/** @brief Target
  *
  * @todo: document this function
  */
 Target::Target()
{
m_isEmpty=true;
m_targetType = TAR_NOTHING;
}


/** @brief setTarget
  *
  * @todo: document this function
  */
void Target::setTarget(Object* _object)
{
setType(TAR_OBJECT);
m_objectTargeted = _object;
m_isEmpty=false;
}

/** @brief setTarget
  *
  * @todo: document this function
  */
void Target::setTarget(Ogre::Vector2 _position)
{
setType(TAR_POSITION);
m_positionTargeted = _position;
m_isEmpty=false;
}



/** @brief getQueryFlagsCorresponding
  *
  * @todo: document this function
  */
QueryFlags Target::getQueryFlagsCorresponding()
{
//TODO
QueryFlags query;
/*
if (m_isEmpty){query=0; return query;}
else
{
    switch (m_targetType)
    {
    case TAR_POSITION:break;

    }
}
*/
return query;
}




/** @brief ~Target
  *
  * @todo: document this function
  */
 Target::~Target()
{

}

